/**
 * 
 */
package xj.toolkit.fsm;

import java.util.List;
import java.util.concurrent.ExecutorService;

import xj.toolkit.fsm.event.TimeoutEvent;
import xj.toolkit.util.MutablePropertyable;


/**
 * @author hp
 *
 */
public interface FSMContext extends MutablePropertyable<String, Object> {
	public String 	getCurrentState();
	public long		getCreateTime();
	public long		getLastModify();
	
	public Object 	getEndReason();
	public void		setEndReason(Object reason);
	
	public void 	startTimer(TimeoutEvent event, long delay);
	public void		cancelTimer();
	public void		clearTimer();
	public boolean	isTimeoutActive(TimeoutEvent event);
	
	public Object	getKey();
	public Object	getSnapshot();
	
	public ExecutorService	getService();
	
	//	return all pending event of ctx
	public List<Object> destroy();
	
	public void		fireEventWithTimeout(TimeoutEvent tm, long timeout, String event, Object ... args );
	
	public boolean	isDestroyed();
	
	public long 	getTimeToLive();
}
